<?php

use yii\db\Migration;

/**
 * Handles the creation of table `channel_visit`.
 */
class m171111_034102_create_channel_visit_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('channel_visit', [
            'id' => $this->primaryKey(),
            'ip' => $this->string(64)->comment('访问ip')->notNull(),
            'utm' => $this->string(36)->comment('渠道参数')->notNull(),
            'action' => $this->integer(3)->comment('动作,1为打开首页,2为点击下载')->notNull(),

            'created_at' => $this->dateTime()->comment('创建时间'),
            'created_date' => $this->date()->comment('创建日期'),
        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('channel_visit');
    }
}
